import { defineStore } from 'pinia'
import { getUserInfo } from '../../../api'

export const useUserInfo = defineStore('userInfo', {
    state: () => {
        return {
            userInfo: {},
        }
    },
    persist: true,
    getters: {},
    actions: {
        async getUserMessage() { 
            try {
                const result = await getUserInfo()
            if (result.status !== 200) {
                this.userInfo = {}
            } else {
                this.userInfo = result.data.userInfo
            }
            }
            catch (error) {
                console.log(error)
            }
        }
    },
   
}
)
